﻿@model IEnumerable<HotelManageSystem.Models.ProbationModel> 
<link href= "@Url.Content("~/Content/TelerikGrid.css")"rel="stylesheet" type="text/css" />
<script src="@Url.Content("~/Scripts/jquery-1.7.1.min.js")" type="text/javascript"></script>
<script type="text/javascript">
    $(document).ready(function () {
        $(".PassProbation").click(function () {
            var id = $(this).attr("probationId");
            $.get("/Probation/PassProbation/" + id, null, function (data) {
                $("#content").html(data);
            });
            //设置当前位置为/Probation/PassProbation/,防止刷新跳转到/Probation/Index
            $.post("HumanResources/SetSeesion", { u: "/Probation/PassProbation/" + id }, function () { });
        });
    });

    function onDataBound() {
        $(".PassProbation").click(function () {
            alert("dghs");
            var id = $(this).attr("probationId");
            $.get("/Probation/PassProbation/" + id, null, function (data) {
                $("#content").html(data);
            });
            //设置当前位置为/Probation/PassProbation/,防止刷新跳转到/Probation/Index
            $.post("HumanResources/SetSeesion", { u: "/Probation/PassProbation/" + id }, function () { });
        });
    }
</script>
@(
 Html.Telerik().Grid(Model)
        .Name("BioGraphyOutlineGrid")
        .DataKeys(keys => keys.Add(b => b.ID))
        .DataBinding(dataBinding => dataBinding.Ajax()
            .Select("TelerikAjax", "Probation")
        )
        .Sortable(sorting => sorting
            .SortMode(GridSortMode.SingleColumn))
        .Pageable(paging => paging
            .Style(GridPagerStyles.NextPreviousAndNumeric)
            .Position(GridPagerPosition.Bottom)
            .PageSize(12))
        .Columns(columns =>
                     {
                         columns.Bound(p => p.ID);
                         columns.Bound(p => p.Name);
                         columns.Bound(p => p.Sex);
                         columns.Bound(p => p.Department);
                         columns.Bound(p => p.Post);
                         columns.Bound(p => p.JoinTime);
                         columns.Bound(p => p.ProbationDates);
                         columns.Bound(p => p.PassProbationDate);
                         columns.Bound(p => p.DaysRemaining);
                         columns.Template(b => @Html.Raw("<input class='PassProbation' type='button' value='转正' probationId='"
                             + b.ID + "'/>"))
                                         .ClientTemplate("<input class='PassProbation' type='button' value='转正' " +
                                                         "probationId='<#= ID #>'/>");
                     })
        .Selectable()
        .Filterable()
        .ClientEvents(events => events.OnDataBound("onDataBound"))
)